using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace CodRevit.Commands
{
    [Transaction(TransactionMode.Manual)]
    public class SwitchThemeCommand : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;

            // 获取当前背景色
            bool isDarkTheme = uiapp.Application.BackgroundColor.Red == 0;

            // 切换主题
            if (isDarkTheme)
            {
                // 切换到浅色主题
                uiapp.Application.BackgroundColor = new Color(255, 255, 255);
                //TaskDialog.Show("主题切换", "已切换到浅色主题");
            }
            else
            {
                // 切换到深色主题
                uiapp.Application.BackgroundColor = new Color(0, 0, 0);
                //TaskDialog.Show("主题切换", "已切换到深色主题");
            }

            return Result.Succeeded;
        }
    }
}